<extend name="Layout/ins_page" />
<block name="content">
	<style>
		.sub-sidebar li.active {
			background: #f2f2f2;
		}
		.content-wrap * {
			line-height: 28px;
		}
		@media screen and (max-width: 768px) {
			.tt .layui-form-label {
				width: 100%;
				text-align: left;
			}
			.tt .layui-input-block {
				width: 100%;
				text-align: left;
				margin-left: 0px;
			}
		}
	</style>
	{:W('PageHeader/adv_search',array('name'=>$work_title.'查询','search'=>'M'))}
	<div class="x-panel hidden" id="adv_search">
		<form method="post" name="form_adv_search" id="form_adv_search" >
			<div class="x-panel-header">
				<h4>高级搜索</h4>
				<div class="split"></div>
				<a  class="btn" id="submit_adv_search">搜索</a>
				<a  class="btn btn-cancel" id="close_adv_search">关闭</a>
			</div>
			<div class="x-panel-header-body">
				<div class="frame">
					<div class="bit-2">
						<div class="layui-form-item">
							<label class="layui-form-label" for="eq_dept_id">部门：</label>
							<div class="layui-input-block">
								<select class="layui-input" name="eq_dept_id">
									<option value="">选择部门</option>
									{$dept_list}
								</select>
							</div>
						</div>
					</div>
					<div class="bit-2">
						<div class="layui-form-item">
							<label class="layui-form-label" for="eq_user_id">登录人：</label>
							<div class="layui-input-block">
								<input class="layui-input" type="text" id="eq_user_id" name="eq_user_id">
							</div>
						</div>
					</div>
				</div>
				<div class="frame">
					<div class="bit-2">
						<div class="layui-form-item">
							<label class="layui-form-label" for="content">内容：</label>
							<div class="layui-input-block">
								<input class="layui-input" type="text" id="li_content" name="li_content">
							</div>
						</div>
					</div>
					<div class="bit-2">
						<div class="layui-form-item">
							<div class="layui-inline">
								<label class="layui-form-label">登录时间：</label>
								<div class="layui-input-inline" style="width: 100px;">
									<input type="text" class="layui-input input-start-date" name="be_create_time" readonly="readonly" />
								</div>
								<div class="layui-form-mid">
									-
								</div>
								<div class="layui-input-inline" style="width: 100px;">
									<input type="text" class="layui-input input-end-date" name="en_create_time" readonly="readonly" />
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div class="oprator-panel">
		<a class="btn-link" id="btn_link" href="{:U('sub')}">下属的日报</a>
		<a class="btn-link" id="btn_link" href="{:U('mine')}">我的日报</a>
		<a class="btn-link" id="btn_link" href="{:U('comment_me')}">评论我的</a>
		<a class="btn-link" id="btn_link" href="{:U('reply_me')}">回复我的</a>
		<span class="split">|</span>
		<a class="btn" id="btn_add">新建</a>
	</div>
	<div class="sub-frame">
		<div class="sub-sidebar">
			<div class=" ul-table">
				<ul>
					<li class="thead">
						<span class="col-9">部门</span>
						<span class="col-5">姓名</span>
						<span class="col-6 grow-1">日期</span>
						<span class="col-4">操作</span>
					</li>
					<volist name="list" id="vo">
						<li data="{$vo.id}">
							<span class="col-9">部门部门部门</span>
							<span class="col-5">{$vo.user_name}</span>
							<span class="col-6 grow-1">{$vo.work_date}</span>
							<span class="col-4"><a href="{:U('edit',array('id'=>$vo['id']))}">修改</a></span>
						</li>
					</volist>
				</ul>
			</div>
			<notempty name="list">
				<div class="pagination">
					{$page}
				</div>
			</notempty>
		</div>
		<div class="sub-content">
			<div class="frame" >
				<div class="bit-1" style="background:#f5f5f5;padding-top:15px;border:1px solid #ddd;">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">起止日期：</label>

							<div class="layui-input-inline"  style="width:100px">
								<input type="text" class="layui-input " id="start_date" name="start_date" readonly="readonly">
							</div>
							<div class="layui-form-mid">
								-
							</div>
							<div class="layui-input-inline" style="width:100px">
								<input type="text" class="layui-input " id="end_date" name="end_date" readonly="readonly">
							</div>
						</div>
					</div>
					<div class="layui-form-item tt">
						<label class="layui-form-label">工作内容：</label>
						<div class="layui-input-block">
							<div class="content-wrap" id="content" style="height:200px;overflow-y: auto;"></div>
						</div>
					</div>
					<div class="layui-form-item tt">
						<label class="layui-form-label">工作计划：</label>
						<div class="layui-input-block">
							<div class="content-wrap" id="plan" style="height:200px;overflow-y: auto;"></div>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">附件：</label>
						<div class="layui-input-block" id="add_file">
							<ul class="file_list" id="file_list"></ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'editor'], function() {
			var $ = layui.jquery;
			set_return_url(null);

			$("#btn_add").on('click', function() {
				window.open("{:U('add')}&type={$type}", "_self");
			});

			$(".sub-sidebar li").on("click", function() {
				$(".sub-sidebar li").removeClass('active');
				$(this).addClass("active");
				$id = $(this).attr("data");
				send_ajax("{:U('get_work_log')}", "id=" + $id, function(ret) {
					$("#work_log_title").html(ret.user_name + to_date(ret.create_time));
					$("#start_date").val(ret.start_date);
					$("#end_date").val(ret.end_date);
					$("#content").html(ret.content);
					$("#plan").html(ret.plan);
					$("#add_file").html(ret.html);
				});
			});

			function to_date(date) {
				return new Date(parseInt(date) * 1000).toLocaleString().replace(/:\d{1,2}$/, '');
			};

			$("select[name='eq_dept_id']").change(function() {
				$("select[name='eq_user_id']").html("");
				send_ajax("{:U('get_user_list')}", "dept_id=" + $(this).val(), function(data) {
					for (var v in data) {
						$("select[name='eq_user_id']").append("<option value='" + v + "'>" + data[v] + "</option>");
					}
				});
			});
		});
	</script>
</block>